package DataAccess;

import DataAccess.*;

/** 
 Data Access Layer Object Collection Of DaiGou
*/
public class DaiGouCollection extends DataAccessCollectionBase
{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ����ͻ���
	public DaiGouCollection()
	{
		super();
	}
	@Override
	protected DataTable BuildTable()
	{
		DataTable dt = new DataTable();
		dt.Columns.Add("Id",Integer.class);
		dt.Columns.Add("CaiZ_Name",String.class);
		dt.Columns.Add("CaiZhong_Id",Integer.class);
		dt.Columns.Add("CaiZhong_Id2",Integer.class);
		dt.Columns.Add("Hy_Num",Integer.class);
		dt.Columns.Add("Hy_Name",String.class);
		dt.Columns.Add("QiHao",String.class);
		dt.Columns.Add("Number",String.class);
		dt.Columns.Add("zhushu",String.class);
		dt.Columns.Add("Multiple",String.class);
		dt.Columns.Add("Unitprice",java.math.BigDecimal.class);
		dt.Columns.Add("Totalprice",java.math.BigDecimal.class);
		dt.Columns.Add("Zt",String.class);
		dt.Columns.Add("zhuihao",String.class);
		dt.Columns.Add("Addtime",java.time.LocalDateTime.class);
		dt.Columns.Add("Cac",String.class);
		dt.Columns.Add("Ca_MD5",String.class);
		dt.Columns.Add("CaDown",Integer.class);
		dt.Columns.Add("CaDownTime",java.time.LocalDateTime.class);
		dt.Columns.Add("CaDownIp",String.class);
		dt.Columns.Add("ca",Boolean.class);
		dt.Columns.Add("caFile",String.class);
		dt.Columns.Add("chuli",Boolean.class);
		dt.Columns.Add("Rnd",String.class);
		dt.Columns.Add("Dg_MD5",String.class);
		dt.Columns.Add("Cp_Num",String.class);
		dt.Columns.Add("Cp_info",String.class);
		dt.Columns.Add("Cp_time",java.time.LocalDateTime.class);
		dt.Columns.Add("Cp_Type",String.class);
		dt.Columns.Add("Cp_add",String.class);
		dt.Columns.Add("Cp_user",String.class);
		dt.Columns.Add("Cp_image",String.class);
		dt.Columns.Add("Zj",String.class);
		dt.Columns.Add("Zj_Zhushu",Integer.class);
		dt.Columns.Add("Zj_Haoma",String.class);
		dt.Columns.Add("Zj_Jiangjin",java.math.BigDecimal.class);
		dt.Columns.Add("Zj_Jiajiang",java.math.BigDecimal.class);
		dt.Columns.Add("Zj_Fanjiang",String.class);
		dt.Columns.Add("Zj_Koushui",java.math.BigDecimal.class);
		dt.Columns.Add("Zj_Shijian",String.class);
		dt.Columns.Add("Zj_Chuliren",String.class);
		dt.Columns.Add("Zj_MD5",String.class);
		return dt;
	}
	@Override
	protected DataAccessBase GetItemByIndex(int index)
	{
		return new DaiGou(_DataTable.Rows[index]);
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ����ͻ���
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ����
	public final DataTable getTable()
	{
		return super._DataTable;
	}
	public final DaiGou getItem(int index)
	{
		return new DaiGou(_DataTable.Rows[index]);
	}
	public final void setItem(int index, DaiGou value)
	{
		_DataTable.Rows.RemoveAt(index);
		_DataTable.Rows.InsertAt(value.getDataRow(),index);
	}
	public enum Field
	{
		Id,
		CaiZ_Name,
		CaiZhong_Id,
		CaiZhong_Id2,
		Hy_Num,
		Hy_Name,
		QiHao,
		Number,
		zhushu,
		Multiple,
		Unitprice,
		Totalprice,
		Zt,
		zhuihao,
		Addtime,
		Cac,
		Ca_MD5,
		CaDown,
		CaDownTime,
		CaDownIp,
		ca,
		caFile,
		chuli,
		Rnd,
		Dg_MD5,
		Cp_Num,
		Cp_info,
		Cp_time,
		Cp_Type,
		Cp_add,
		Cp_user,
		Cp_image,
		Zj,
		Zj_Zhushu,
		Zj_Haoma,
		Zj_Jiangjin,
		Zj_Jiajiang,
		Zj_Fanjiang,
		Zj_Koushui,
		Zj_Shijian,
		Zj_Chuliren,
		Zj_MD5;

		public int getValue()
		{
			return this.ordinal();
		}

		public static Field forValue(int value)
		{
			return values()[value];
		}
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ����
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ��������
	protected final boolean ListByCondition(String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"					*" + "\r\n" +
"				  From DaiGou" + "\r\n" +
"				 Where " + condition + "\r\n" +
"			";
		return super.ListBySql(sql);
	}

	public final boolean ListAll()
	{
		String condition = "1=1";
		return ListByCondition(condition);
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ��������
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ���淽��


	/** 
	 �г����� Rnd �� 1  Cac �� Cac ������ ���з��� 
	 
	 @param Cac
	 @return 
	*/
	public final boolean ListAllNeedBackMoney(String Cac)
	{
		//string condition = "1=1 And Rnd=1  And Cac='"+Cac+"' ";			//�¼ӡ���������������������������������������������������������������������
		String condition = "1=1 And Cac='" + Cac + "' and zt ='����Ʊ' ";
		return ListByCondition(condition);
	}

	public final boolean ListAllNeedBackMoney(String Cac, String Qihao)
	{
		String condition = "1=1 And Rnd=1 And Cac='" + Cac + "' and qihao = '" + Qihao + "' ";
		return ListByCondition(condition);
	}

	public final boolean ListAllNeedBackMoneyIfZhuihao(String Cac, String Qihao)
	{
		String condition = "1=1 And Rnd='2' And Cac='" + Cac + "' and qihao = '" + Qihao + "' ";
		return ListByCondition(condition);
	}












	public final boolean ListAllRich()
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"					*" + "\r\n" +
"				  From DaiGou" + "\r\n" +
"				 Where  zj_jiangjin <> 0 order by qihao desc";
		return super.ListBySql(sql);
	}




	public final boolean ListAllByCaizhongid(int Caizhongid)
	{
		String condition = "1=1 And Caizhong_id =" + String.valueOf(Caizhongid);
		return ListByCondition(condition);
	}



	public final boolean ListByCaizhongid(String caizhongid)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"					*					" + "\r\n" +
"				  From DaiGou" + "\r\n" +
"				 Where Zt = 'δ����'" + " And Caizhong_id =" + Helper.ToSQLParamStr(caizhongid) + " Order by Addtime desc";
		return super.ListBySql(sql);
	}


	public final boolean ListAllNoEncashByHynumAndCaizhongId(int Hy_Num, String caizhongid)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				*" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where  Hy_Num =" + String.valueOf(Hy_Num) + " And Zj = 'δ����'" + " And Caizhong_id =" + Helper.ToSQLParamStr(caizhongid) + " Order by Addtime desc";
		return super.ListBySql(sql);
	}
	/** 
	 �г�δ�ҽ��ļ�¼
	 
	 @param Hy_Num
	 @param caizhongid
	 @return 
	*/
	public final boolean ListNoEncashByHyhumCaizhongid(String caizhongid)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"					*					" + "\r\n" +
"				  From DaiGou" + "\r\n" +
"				 Where  Zj = 'δ�ҽ�'" + " And Caizhong_id =" + Helper.ToSQLParamStr(caizhongid) + " Order by Addtime desc";
		return super.ListBySql(sql);
	}



	/** 
	 
	 
	 @param Hy_Num
	 @return 
	*/
	public final boolean ListAllCaizhongmingcheng()
	{
		String sql = "" + "\r\n" +
"					Select Id , Name" + "\r\n" +
"				  From Caizhong where id2 <> 0";
		return super.ListBySql(sql);
	}
	public final boolean ListTopOneByNumId(int ID)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"					top 1 *					" + "\r\n" +
"				  From DaiGou" + "\r\n" +
"				 Where  Hy_Num =" + String.valueOf(ID) + " And Zt = 'δ����' Order by Addtime desc";
		return super.ListBySql(sql);
	}

	/** 
	 δ��Ʊ�е�
	 
	 @param ID
	 @return 
	*/
	public final boolean ListAllHadNoOut(int Caizhong_id)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				*					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where  Caizhong_id = " + String.valueOf(Caizhong_id) + " And Zt = 'δ����' ";
		return super.ListBySql(sql);
	}


	public final boolean ListByCaizhongid(int hyNum, String CaizhongID)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				*					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where Hy_Num =" + String.valueOf(hyNum) + " And Caizhong_id = @" + Helper.ToSQLParamStr(CaizhongID);
		return super.ListBySql(sql);
	}

//	Where zt = '����Ʊ' and rnd ='0' and qihao =" +Helper.ToSQLParamStr(Qihao) + condition;
	//���ݵ�ǰ�ں��ҵ�ǰ����Ʊ��¼
	public final boolean ListThisDateByThisQihao(String Qihao, String Cp_user, String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				*					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ'  and qihao =" + Helper.ToSQLParamStr(Qihao) + condition;
		return super.ListBySql(sql);
	}

	//	Where zt = '����Ʊ' and  rnd ='0' and cp_user = ''  and qihao =" +Helper.ToSQLParamStr(Qihao) + condition ;
	public final boolean ListThisDateByThisQihao(String Qihao, String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				 *					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"			" + "\r\n" +
"			Where zt = '����Ʊ'   and qihao =" + Helper.ToSQLParamStr(Qihao) + condition;
		return super.ListBySql(sql);
	}



	//�����ںŲ��ҵ�ǰ�ڵ�δ��Ʊ��
	public final boolean ListCount(String Qihao, String condition)
	{

		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				 *					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ'  and  qihao =" + Helper.ToSQLParamStr(Qihao);
		return super.ListBySql(sql);
	}

	public final boolean ListCountLest(String Qihao, String condition)
	{

		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				 *					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ'  and  qihao <" + Helper.ToSQLParamStr(Qihao);
		return super.ListBySql(sql);
	}





//
//		string sql = @"
//				Select
//				top 1 *					
//				From DaiGou
//				Where zt = '����Ʊ' and  rnd ='0' and  qihao =" +Helper.ToSQLParamStr(Qihao) + condition;
//

	//��������ĳ����ƱԱ�ĳ�Ʊ����
	public final boolean ListME(String Qihao, String condition)
	{

		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				 *					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ' and  rnd ='0' and  qihao =" + Helper.ToSQLParamStr(Qihao) + condition;
		return super.ListBySql(sql);
	}


	//��������ĳ����ƱԱ�ĳ�Ʊ����
	public final boolean ListAllForPower(String Qihao, String condition)
	{

		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				*		" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ' and  qihao =" + Helper.ToSQLParamStr(Qihao);
		return super.ListBySql(sql);
	}


	//		public bool ListME (string Qihao)
	//		{
	//			string sql = @"
	//				Select
	//				top 1 *					
	//				From DaiGou
	//				Where zt = '����Ʊ' and cp_user = ''  and qihao =" +Helper.ToSQLParamStr(Qihao) ;
	//			return base.ListBySql(sql);
	//		}



	//���ݵ�ǰ�ں�δ��Ʊ���м�¼
	public final boolean ListThisDateLeaveByThisQihao(String Qihao, String Cp_user, String conditon)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				*					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ' and  rnd ='0' and qihao =" + Helper.ToSQLParamStr(Qihao) + conditon;
		return super.ListBySql(sql);
	}

	public final boolean ListThisDateLeaveByThisQihao(String Qihao, String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				*					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ' and  rnd ='0' and qihao =" + Helper.ToSQLParamStr(Qihao) + condition;
		return super.ListBySql(sql);
	}





	//���ݹ��ڵļ�¼
	public final boolean ListByID(int ID)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				top 1 *					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where id = '" + ID + "'";
		return super.ListBySql(sql);
	}

	public final boolean ListPastDateByThisQihao(String Qihao, String Cp_user, String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				 *					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ'  and  qihao <" + Helper.ToSQLParamStr(Qihao) + condition;
		return super.ListBySql(sql);
	}

	public final boolean ListPastDateByThisQihao(String Qihao, String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				 *					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ' and qihao <" + Helper.ToSQLParamStr(Qihao) + condition;
		return super.ListBySql(sql);
	}



	//�������д���Ʊ
	public final boolean ListAllByThisQihao(String Qihao, String Cp_user, String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				*					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ' " + condition;

		return super.ListBySql(sql);
	}

	public final boolean ListAllByThisQihao(String Qihao, String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"				*					" + "\r\n" +
"				From DaiGou" + "\r\n" +
"				Where zt = '����Ʊ' " + condition;
		return super.ListBySql(sql);
	}
















//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ���淽��
}